package spring.importBeanDefinitionRegistrar;

import org.springframework.context.ApplicationContext;
import org.springframework.context.annotation.AnnotationConfigApplicationContext;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.Import;

/**
 * ImportBeanDefinitionRegistrar 测试：
 *
 * @author ME
 * @date 2021/5/20
 */
public class TestImportBeanDefinitionRegistrar {

    public static void main(String[] args) {
        ApplicationContext context = new AnnotationConfigApplicationContext(SpringConfig.class);

        MyImportBeanDefinitionRegistrar service = context.getBean(MyImportBeanDefinitionRegistrar.class);
        System.out.println("MyImportBeanDefinitionRegistrar 不会被注册为 Spring Bean，输出这句话就说明配置是不对的。");
    }

    @Configuration
    @Import(MyImportBeanDefinitionRegistrar.class)
    @Deprecated
    public static class SpringConfig {
    }


}
